<template>
    <swiper :options="swiperOption">
      <!--<router-link :to="{name:'detail',parmas:{bid:slide.bookId}}" v-for="(slide,key) in swiperSlides" :key="key" tag="swiper-slide">-->
      <swiper-slide v-for="(slide,key) in swiperSlides" :key="slide.bookId">
          <img  alt="" :src="slide.bookCover" @click="Detail(slide.bookId)">
          <p>{{slide.bookName}}</p>
      </swiper-slide>
      <div class="swiper-pagination" slot="pagination" v-show="false"></div>

      <!--</router-link>-->
    </swiper>
</template>
<script>
  export default {
    name: 'live',
    props:['swiperSlides','W'],
    data() {
      return {
        swiperOption: {
          //是否自动滑动
          // autoplay:true,
          // delay: 1000,//1秒切换一次
          //Swiper使用flexbox布局(display: flex)，开启这个设定会在Wrapper上添加等于slides相加的宽或高，在对flexbox布局的支持不是很好的浏览器中可能需要用到。
          setWrapperSize: true,
          pagination: {
            el: '.swiper-pagination'
          },
          //鼠标是否可以拖动，默认true
          // mousewheelControl:false,
          observeParents: true,
          width: this.W,
        }
      }
    },
    methods:{
      Detail(id){
        console.log(id);
        this.$router.push({
          name:'detail',
          params:{
            bid:id,
          }
        })
      }
    },
    created(){
      console.log(this.W);
    }
  }
</script>
<style scoped>
  a{
    display:inline-block;
    p{
      color: #000;
    }
  }
</style>
